package com.mingjie.daydayup;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.Toast;

public class AActivity extends Activity {

    private Button button;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_a);
        button = (Button) findViewById(R.id.btn_2b);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
//                Intent intent = new Intent();
//                intent.setAction("com.mingjie.daydayup");
//                intent.setData(Uri.parse("wqj:123"));
//                intent.addCategory(Intent.CATEGORY_DEFAULT);
//                startActivity(intent);
                Intent intent=new Intent(AActivity.this,BActivity.class);
                startActivityForResult(intent,0);
            }
        });
    }

    @Override
    protected void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
       Bundle bundle= data.getExtras();
        Toast.makeText(this,bundle.getString("name")+bundle.getString("sex"),Toast.LENGTH_SHORT).show();
    }
}
